var ns;
var app = new Vue({
    el: '#app',
    data: {
        showstandard:false,
        form: {
            ID: 0,
            DeviceName: '',
            DeviceNo: '',
            ProjectName: '',
            CheckTime: '',
            InChargeManName: '',
            CheckStatus: 1,
            TaskCompleteContent: '',
            GPSLocation: '',
        },
        standardlist: [],
        imglist: [],
        imgindex: 0,
        // form:{"ID":"2435","DeviceName":"货梯2","DeviceNo":"DT002","DeviceModel":null,"DeviceLocationPlace":null,"ProjectName":"水韵书香","CheckTime":"2022-05-26 16:37","InChargeManName":"唐娟","CheckStatus":2,"TaskStatus":3,"TaskCompleteContent":"测试异常","GPSLocation":"重庆市重庆市永川区和顺大道","IsAllowUpload":true},
        // standardlist:[{"ID":59,"StandardName":"测试1","CheckStatus":2},{"ID":60,"StandardName":"测试2","CheckStatus":1},],
        // imglist:[
        //     {"ID":52,"index":1,"url":"http://192.168.0.46:8003/upload/Mall/APPHome/20220526/97daca1d122a433cb278b43108980b2b_12caac2bc4260406cd6f03d77f59fda9.jpg","thumbPath":"http://192.168.0.46:8003/upload/Mall/APPHome/20220526/97daca1d122a433cb278b43108980b2b_12caac2bc4260406cd6f03d77f59fda9.jpg","isupload":false}
        // ],
        // imgindex:1,
        select_imglist: [],
        select_imgindex: 0,
        maxuploadcount: CONFIG.maxuploadcount,
        standardStatus: 0
    },
    methods: {
        doSelectStandard:function(){
            var that = this;
            that.showstandard=!that.showstandard;
        },
        get_data: function () {
            var that = this;
            var options = {};
            options.action = "getequipmenttaskdevicedata";
            options.ID = that.form.ID;
            ns.post(options, function (succeed, data, err) {
                if (succeed) {
                    that.form = data.formdata;
                    that.standardlist = data.standardlist;
                    that.imglist = data.imglist;
                    that.imgindex = data.imglist.length;
                } else if (err) {
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
            }, {
                toast: true
            });
        },
        do_viewimages: function (activeIndex) {
            var that = this;
            var imageUrls = [];
            for (var i = 0; i < that.imglist.length; i++) {
                imageUrls.push(that.imglist[i].url);
            }
            var imageBrowser = api.require('imageBrowser');
            imageBrowser.openImages({
                showList: false,
                activeIndex: activeIndex,
                imageUrls: imageUrls
            });
        }
    }
});
apiready = function () {
    api.parseTapmode();
    ns = window.Foresight.Util;
    app.form.ID = api.pageParam.id || 0;
    toast = new auiToast();

    setTimeout(function () {
        app.get_data();
    }, 300)
   
}
